<?php if(!defined('IN_PISCES')){exit('Access Denied.');}?>

<link href="{$this->data['baseurl']}css/tzm/member.css" rev="stylesheet" rel="stylesheet" type="text/css" media="screen">
<div class="nav_m w1000"> <span class="left a1">当前位置：</span> <span class="left"><a class="ft" href="{$this->data['baseurl']}">返回首页</a> &gt; <a class="ft" href="{url('User','Order')}">用户中心</a> &gt;申请返现</span> </div>
<div class="w1000"> 
  <!--左--> 
  {include $this->templateDir . 'component/user-left.php'} 
  <!--左 end-->
  <div class="rightpane right"> 
    <!--右-->
    <div class="left mid_a">
      <div class="left w827">
        <div class="left">
          <div class="tx"> <span class="img"> <img src="{$this->data[user]['logo']}"></span></div>
        </div>
        <div class="right ninf">
          <p class="left wp">用 户 名: {$this->data['user']['username']}</p>
          {if $this->data['return']['rate']>0}
          <p class="left wp">支 付 宝：{if $this->data['user']['alipay_account']}{$this->data['user']['alipay_account']}{else}<a href="{url('User','AlipayAccount')}">设置支付宝账号</a>{/if}</p>
          <p class="left wp">账户余额：<a href="{url('Return','Index')}">{$this->data['user']['money']}</a></p>
          {else}
          <div class="lpdh_wujl left">暂末开启返现功能,请稍后关注.</div>
          {/if} </div>
      </div>
    </div>
    <div class="clear mt10"></div>
    {if $this->data['return']['rate']>0} 
    <script>
function cc(){
	 document.getElementById('note').style.display='none';
	 }
</script>
    <div id="note"> 
    <span onclick="cc()" class="close"></span>
      <div class="mylist_note">注意：目前我们只支持淘宝网返现,暂时不支持其他购物的返现.功能正在开发中. 正常情况下，您通过本网站链接去淘宝网购物，淘宝网返利订单非即时反馈，在您确认收货后的第二天才会自动反馈到本处。订单将会显示在这里,在此只能够查询到返利的订单；不返利无法查询到订单 </div>
      <div class="clear10"></div>
    </div>
    <div class="clear mt10"></div>
    <div class="bb1_a bg01">
      <div class="mylist_menu c_gray">
        <ul class="left">
          <li><span></span>返现申请<i></i></li>
        </ul>
        <span class="inf">您当前预计最高可返<i>{$this->data['user']['money']}</i>元</span> </div>
      <div class="mylist_inf">你可以在这里申请可用于返现的金额.</div>
      <div class="lpdh_biao1"> 
      {if $this->data['return_setting']['rate']<=0}
      <div class="lpdh_wujl left">系统不支持返现</div>
        {else} 
        <!--没有订单版-->
        <div class="lpdh_wujl left">您当前的可返现金额是 <strong>{$this->data['info']['money']}</strong> 元<br />
每次最少返现 <strong>{$this->data['return_setting']['return_min']}</strong> 元</div>
        {if $this->data['return_setting']['return_min']>$this->data['info']['money']}
<div class="lpdh_wujl left">您的可返现金额少于最小返现金额<strong>{$this->data['return_setting']['return_min']}</strong>元，暂时无法申请返现</div> 
{else}
<div class="unlogin_form fl">
<form id="form" action="{url('Return','SaveEdit')}" method="post">
<p> 
<label for="money">返现金额:</label> 
<input type="text" size="30" name="money" id="money" class="noime txt_input r3px" value="{$this->data['info']['money']}" /> 
<span class="hint" id="money_info" etype="error_info"></span> 
</p>
<input type="hidden" id="hdMinMoney" value="{$this->data['return_setting']['return_min']}" />
<input type="hidden" id="hdTotalMoney" value="{$this->data['info']['money']}" />
<input type="submit" value="确认申请" name="commit" id="btnAjaxSubmit" class="text blue_btn blue_btn2 r3px f14"/> 
</form>
</div>
 {/if}
        <div class="clear mt10"></div>
        <div class="left lpdh_wujl2 f12 nr12">你可以<a href="{url('Post','Product')}">通过本站购物，晒所买商品，可获额外奖励哦!&gt;&gt;</a></div>
        <div class="clear mt10"></div>
        {/if}
      </div>
    </div>
    <div class="clear mt10"></div>
    <div class="user_inf">
      <dl class="user_inf">
        <dt>待返订单：</dt>
        <dd>
          <p><b></b><!--<a href="#" target="_blank">查看待返订单&gt;&gt;</a>--></p>
          <p class="f12 c_gray">下单后被跟踪即为待反订单，去商城完成交易且无退换货后，一定时间内可获得返利现金。</p>
        </dd>
        <dt>已返订单：</dt>
        <dd>
          <p><b></b><!--<a href="#" target="_blank">查看已返订单&gt;&gt;</a>--></p>
          <p class="f12 c_gray">完成支付并且没有发生退换货的订单，在核对无误情况下该笔订单为已返利订单</p>
        </dd>
        <dt class="line"></dt>
        <dt>帐户余额：</dt>
        <dd>
          <p><b></b><!--<a href="#" target="_blank">查看详情&gt;&gt;</a>--></p>
          <p class="f12 c_gray">订单确认后，返利现金将返还到您在本网注册的账户里面</p>
        </dd>
        <dt>申请返现：</dt>
        <dd>
          <p><b></b><!--<a href="#" target="_blank">查看详情&gt;&gt;</a>--></p>
          <p class="f12 c_gray">当你达到申请返现额度时,即可申请返现订单返现你设置的支付宝帐号中.</p>
        </dd>
      </dl>
    </div>
    <!--右--> 
    {/if} 
    </div>
</div>
<script language="javascript" src="{$this->data['baseurl']}js/jquery/jquery.js"></script>
<script language="javascript" src="{$this->data['baseurl']}js/jquery/form.js"></script>
<script language="javascript" src="{$this->data['baseurl']}js/utils.js"></script>
<script type="text/javascript">
var successFun=function(res){
if(res.code==200){
	document.location	= res.data.forward;
}else{
	alert('出错了，请重新尝试！');
}
}
function beforeSend(){
	if(!checkMoney()){
		return false;
	}
	//$('#btnAjaxSubmit').attr('disabled',true);
}
$(document).ready(function() { 
	var updateOptions	= {dataType:'json',error:doError,beforeSend:beforeSend,success:doSuccess}
    $('#form').ajaxForm(updateOptions); 
}); 
function checkMoney(){
	var money		= parseInt($('#money').val());
	var minMoney	= parseInt($('#hdMinMoney').val());
	var totalMoney	= parseInt($('#hdTotalMoney').val());
	if(money>totalMoney){
		$('#money_info').html('返现金额不能超过可返现金额');
		return false;
	}
	if(money<minMoney){
		$('#money_info').html('返现金额不能少于最小返现金额');
		return false;
	}
	return true;
}
</script>